import { post } from 'utils/fetch';


// 获取根组织信息
export const getRootOrg = () => {
  return post(`/flow-platform/4A/getRootOrg`, null, { messageType: 'close' });
}

// 获取指定组织子组织信息
export const getOrgsByParentCode = (data) => {
  return post(`/flow-platform/4A/getOrgsByParentCode`, data, { messageType: 'close' });
  /*
  console.log("getOrgsByParentCode called: ", JSON.stringify(data, null, 2));
  return Promise.resolve({
    errCode: 0,
    errMsg: '',
    datas: [
      {
        "ORG_ID": "7d51e7f373f9436d995ecc057d6ef79b",
        "FULL_CODE": "liucheng",
        "ORG_NAME": "流程平台",
        "ORG_ENDDATE": "",
        "ORG_STARTDATE": "20190225000000+0800",
        "PARENT_ID": "",
        "ORG_TYPE": "",
        "PARENT_CODE": "1919f623b5d140598b4eb80660715055",
        "ORG_STATUS": "1",
        "ORG_CODE": "liucheng",
        "OTHER_NAME": "流程平台",
        "FULL_NAME": "流程平台",
        "ORG_INDATE": "20190225000000+0800",
        "OLD_ORG_CODE": "liucheng",
        "ORDERCODE": "liucheng",
        "children": [
          {
            "ORG_ID": "3f3fed8e82f545c5b40911eb7bf68425",
            "FULL_CODE": "fenju",
            "ORG_NAME": "分局1",
            "ORG_ENDDATE": "",
            "ORG_STARTDATE": "",
            "PARENT_ID": "",
            "ORG_TYPE": "",
            "PARENT_CODE": "7d51e7f373f9436d995ecc057d6ef79b",
            "ORG_STATUS": "1",
            "ORG_CODE": "fenju",
            "OTHER_NAME": "分局1",
            "FULL_NAME": "分局1",
            "ORG_INDATE": "",
            "OLD_ORG_CODE": "fenju",
            "ORDERCODE": "fenju",
            "children": []
          },
          {
            "ORG_ID": "4575efb92fb645b48578e5a1533fee04",
            "FULL_CODE": "shiju",
            "ORG_NAME": "市局1",
            "ORG_ENDDATE": "",
            "ORG_STARTDATE": "",
            "PARENT_ID": "",
            "ORG_TYPE": "",
            "PARENT_CODE": "7d51e7f373f9436d995ecc057d6ef79b",
            "ORG_STATUS": "1",
            "ORG_CODE": "shiju",
            "OTHER_NAME": "市局1",
            "FULL_NAME": "市局1",
            "ORG_INDATE": "",
            "OLD_ORG_CODE": "shiju",
            "ORDERCODE": "shiju",
            "children": []
          },
          {
            "ORG_ID": "e27258dc96e041e19edf80a4c9b7f036",
            "FULL_CODE": "hzjqzx",
            "ORG_NAME": "杭州警情中心",
            "ORG_ENDDATE": "",
            "ORG_STARTDATE": "",
            "PARENT_ID": "",
            "ORG_TYPE": "",
            "PARENT_CODE": "7d51e7f373f9436d995ecc057d6ef79b",
            "ORG_STATUS": "1",
            "ORG_CODE": "hzjqzx",
            "OTHER_NAME": "杭州警情中心",
            "FULL_NAME": "杭州警情中心",
            "ORG_INDATE": "",
            "OLD_ORG_CODE": "hzjqzx",
            "ORDERCODE": "hzjqzx",
            "children": [
              {
                "ORG_ID": "68442dd22bda41b0b2671190aa834b32",
                "FULL_CODE": "hzjqjy",
                "ORG_NAME": "警员",
                "ORG_ENDDATE": "",
                "ORG_STARTDATE": "",
                "PARENT_ID": "",
                "ORG_TYPE": "",
                "PARENT_CODE": "e27258dc96e041e19edf80a4c9b7f036",
                "ORG_STATUS": "1",
                "ORG_CODE": "hzjqjy",
                "OTHER_NAME": "警员",
                "FULL_NAME": "警员",
                "ORG_INDATE": "",
                "OLD_ORG_CODE": "hzjqjy",
                "ORDERCODE": "hzjqjy",
                "children": []
              },
              {
                "ORG_ID": "b1c325796fe445fa965e87412a1acd85",
                "FULL_CODE": "hzjqpcs",
                "ORG_NAME": "派出所",
                "ORG_ENDDATE": "",
                "ORG_STARTDATE": "",
                "PARENT_ID": "",
                "ORG_TYPE": "",
                "PARENT_CODE": "e27258dc96e041e19edf80a4c9b7f036",
                "ORG_STATUS": "1",
                "ORG_CODE": "hzjqpcs",
                "OTHER_NAME": "派出所",
                "FULL_NAME": "派出所",
                "ORG_INDATE": "",
                "OLD_ORG_CODE": "hzjqpcs",
                "ORDERCODE": "hzjqpcs",
                "children": []
              },
              {
                "ORG_ID": "b7a702189d4045eb98c62535c3fc6fd1",
                "FULL_CODE": "hzfj",
                "ORG_NAME": "分局",
                "ORG_ENDDATE": "",
                "ORG_STARTDATE": "",
                "PARENT_ID": "",
                "ORG_TYPE": "",
                "PARENT_CODE": "e27258dc96e041e19edf80a4c9b7f036",
                "ORG_STATUS": "1",
                "ORG_CODE": "hzfj",
                "OTHER_NAME": "分局",
                "FULL_NAME": "分局",
                "ORG_INDATE": "",
                "OLD_ORG_CODE": "hzfj",
                "ORDERCODE": "hzfj",
                "children": []
              }
            ]
          },
        ]
      }
    ],
  })
  */
}

// 获取指定组织下所属人员信息
export const getUserByOrgCode = (data) => {
  return post(`/flow-platform/4A/getUserByOrgCode`, data, { messageType: 'close' });
}

// 根据名称模糊搜索用户
export const getUserListByNameFuzzy = (data) => post(`/flow-platform/4A/getUserListByNameFuzzy`, data);


// 查询员工信息
export const selectEmployeeList = (data) => post(`/flow-platform/api/v1.0/public/selectEmployeeList`, data);